import os
import re
import codecs
import sys
import sqlite3
from CaffeProject.util.parameter import Para


"""
def main():
    info_file_name="/root/Qin Yiqing/CaffeProject/sunzy301-CaffeProject-master/CaffeProject/testFiles/test_label_result.txt"
    with open(info_file_name,"r") as f:
        info_file_str = f.readline()
        rs_name = info_file_str.split(' ')[0]
        ID = int(info_file_str.split(' ')[1])
        X = int(info_file_str.split(' ')[2])
        Y = int(info_file_str.split(' ')[3])
        LAT = float(info_file_str.split(' ')[4])
        LON = float(info_file_str.split(' ')[5])
        LABEL = float(info_file_str.split(' ')[6])
        create_table_sql_1 = '''CREATE TABLE IF NOT EXISTS %s_label_name
            (ID INT PRIMARY KEY     NOT NULL,
            NAME            TEXT    NOT NULL);''' % rs_name
        create_table_sql_2 = '''CREATE TABLE IF NOT EXISTS %s_label
            (ID INT PRIMARY KEY     NOT NULL,
            X   INT                 NOT NULL,
            Y   INT                 NOT NULL,
            LAT REAL                NOT NULL,
            LON REAL                NOT NULL,
            LABEL INT               NOT NULL);''' % rs_name
        with sqlite3.connect(Para.db_name) as conn:
            conn.execute(create_table_sql_1)
            conn.execute(create_table_sql_2)
            temp1 = (ID, rs_name)
            value1 = []
            value1.append(temp1)
            conn.executemany("insert into %s_label_name values (?,?)" % rs_name, value1)
            temp2 = (ID, X, Y, LAT, LON, LABEL)
            value2 = []
            value2.append(temp2)
            conn.executemany("insert into %s_label values (?,?,?,?,?,?)" % rs_name, value2)
if __name__ == "__main__":
    main()
"""